package com.itheima.text3;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class TCPServer {
    public static void main(String[] args) throws IOException {

        ServerSocket ss = new ServerSocket(10003);
        //接收
        while (true) {
            Socket s = ss.accept();
            InputStream is = s.getInputStream();

            byte[] bytes = new byte[1024];
            int len = is.read(bytes);
            String str = new String(bytes, 0, len);

            String ip = ss.getInetAddress().getHostAddress();

            System.out.println(ip + "---" + str);


        }

    }
}
